package com.qk.controller;

import com.qk.common.Result;
import com.qk.entity.User;
import com.qk.service.UserService;
import com.qk.vo.LoginResultVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class LoginController {
    @Autowired
   UserService userService;
    @PostMapping( "/login")
    public Result login(@RequestBody User user){
        log.info("用户登录");
        LoginResultVo loginResultVo = userService.login(user);
        return Result.success(loginResultVo);
    }
}
